from urllib import request
url = 'https://www.douban.com/'
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4621.0 Safari/537.36'
}
req = request.Request(url,headers=header)
response = request.urlopen(req)
# print(response.getcode())
# print(response.status)
# print(response.geturl())
# print(response.info())
html = response.read().decode('utf-8')
# print(html)
request.urlretrieve('https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2897454450.jpg','a.jpg')